We are trying to create an incident in PagerDuty API but getting an error ““code”:2001,“errors”:[“Title cannot be empty.”]”
This is our code:
headers = {'Authorization': 'Token token=xxxxxxxxxxxxx, 'Content-type': 'application/json'}
pg_esc_id = "PCURTLY"
pg_svc_id = "PMRO49S"
# Create PD Incident
url = 'https://api.pagerduty.com/incidents'
payload = {
"incident": {
"type": "incident",
"title": "Testing PG incident creation",
"service": {
"id": pg_svc_id,
"summary": "ioc_dev",
"type": "service_reference",
"self": "https://api.pagerduty.com/services/" + pg_svc_id,
},
"priority": {
"id": "PZPTATR",
"summary": "P4",
"type": "priority"
},
"urgency": "high",
"body": {
"type": "incident_body",
"details": "string"
},
"incident_key": "string",
"escalation_policy": {
"id": pg_esc_id,
"type": "escalation_policy_reference",
"self": "https://api.pagerduty.com/escalation_policies/" + pg_esc_id,
},
}
}
}
data = requests.post(url, data=payload, headers=headers)
print(data.text)
Can some one pls help me here